function myclick() {
    alert(1);
    htmlToExcel($("#tableId").html(), "导出Excel 测试");

}

  /**
         * 将html 生成 Excel 并下载
         * @param {string} content html 内容
         * @param {string} title
         */
  var htmlToExcel = function(content,title) {

    //Worksheet名
    // var worksheet = '南昌铁路局集团有限公司各机务段救援列车人员概况表'
    var uri = 'data:application/vnd.ms-excel;base64,';
    // 真正要导出（下载）的HTML模板
    var exportTemplate = `<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" 
    xmlns="http://www.w3.org/TR/REC-html40">
    <head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet>
        <x:Name>${title}</x:Name>
            <x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet>
        </x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]-->
        <!--外部css和js结束-->
        <style>
            td{
            text-align: center;
            }
            .sjzl_table>tbody>tr>td{
                height: 22px;
                font-family:'宋体';
                font-size:11pt;
                font-weight: 100;
            }
            .sjzl_thead{
                font-family: '仿宋';
                font-size: 13pt;
            }
            .sjzl_first_td{
                border: none;
                font-family: '华文中宋';
                font-size: 16pt;
            }
            .sjzl_date_td{
                border: none;
                font-family: '宋体';
                font-size: 11pt;
                text-align: right;
                padding-right: 72px;
            }
            .sjzl_first_td2{
                border: none;
                font-family: '华文中宋';
                font-size: 10pt;
                height: 20px;
            }
            .sjzl_date_td_left{
                border: none;
                font-family: '宋体';
                font-size: 11pt;
                text-align: left;
                padding-right: 72px;
            }
            .sjzl_font_style{
                font-family: '华文中宋';
                font-size: 10pt;
            }
            .sjzl_a{
                background: white;
                font-weight: 700;
            }
            .sjzl_b{
                background: white;
                font-weight: 700;
            }
            /*导出按钮抽象定位至屏幕右上方*/
            #exportBtn{
                position: absolute;
                right: 100px;
            }
            /*打印按钮抽象定位至屏幕右上方*/
            #printBtn{
                position: absolute;
                right: 10px;
            }
            
        </style>
    </head>
    <body>
        ${content}
    </body>
    
    </html>`;

    //输出base64编码
    var base64 = function(s){
        return window.btoa(unescape(encodeURIComponent(s)))
    }
    //下载模板
    var a = document.createElement("a");
    a.download = title + ".xls";
    a.href = uri + base64(exportTemplate);
    a.click();
};
